class Solution {
public:
    vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
        int n = names.size();
        vector<int> arr(n);
        for (int i = 0; i < n; i++) arr[i] = i;
        sort(arr.begin(), arr.end(), [&](int i, int j) {
            return heights[i] > heights[j];
            });
        vector<string> ret;
        for (auto e : arr)
            ret.push_back(names[e]);
        return ret;
    }
};